var express = require("express");
var router = express.Router();

const { Room } = require("../models");

/* GET home page. */
router.get("/", async (req, resp, next) => {
  // async await
  const result = await Room.findAll();
  resp.send(result);
});

router.post("/data", (req, res, next) => {
  const body = req.body;
  console.log(body);
  // throw new Error("请求data报错");
  res.send({
    code: 200,
    msg: "请求成功",
    data: body,
  });
});

module.exports = router;
